package com.slwish.common.config;

import android.content.Context;

import com.slwish.common.utils.FileUtils;
import com.slwish.common.utils.SDCardUtils;

import java.io.File;


/**
 * 功能描述:
 * <p/>
 * 创 建 人：陈浩
 * 创建时间：2017-9-15
 * 版 本 号：V1.0
 */
public class PathImgHelp {
    /**
     * 保存路径
     */
    public static String tempPathImage = "";
//    public static String userQRImage = "";
//    public static String tempPathVideo = "";
    public static String tempPathFile = "";
    public static String cacheFile = "";
//    public static String tempPathVoice = "";

    /**
     * 图片路径文件夹
     */
    private static final String IMAG_FAIL = "image";
    private static final String USER_IMAG = "user_image";
    /**
     * 视频路径文件夹
     */
    private static final String VIDEO_FAIL = "video";
    private static final String VOICE_FAIL = "voice";
    private static final String FILE_FAIL = "file";

    /**
     * 图片jpg
     */
    public static final String JPG = ".jpg";

    /**
     * 视频3gp
     */
    public static final String TGP = ".3gp";

    /**
     * 创建路径
     *
     * @param mContext 上下文 创建人：徐晓健（2016年2月23日）
     */
    public static void createPath(Context mContext) {
        try {
        // 判断的、能否获取sd卡
        if (SDCardUtils.isSDCardEnable()) {
            String path = mContext.getExternalFilesDir("").getAbsolutePath()+ File.separator;
            String cachePath = mContext.getExternalCacheDir().getAbsolutePath()+ File.separator;
            tempPathImage = path + IMAG_FAIL + "/";
//            tempPathVideo = path + VIDEO_FAIL + "/";
            tempPathFile = path + FILE_FAIL + "/";
            cacheFile = cachePath + FILE_FAIL + "/";
//            tempPathVoice = path + VOICE_FAIL + "/";
//            userQRImage = path + USER_IMAG + "/";
            FileUtils.createOrExistsDir(tempPathImage);
//            FileUtils.createOrExistsDir(tempPathVideo);
            FileUtils.createOrExistsDir(tempPathFile);
//            FileUtils.createOrExistsDir(tempPathVoice);
//            FileUtils.createOrExistsDir(userQRImage);
            //缓存文件目录
            FileUtils.createOrExistsDir(cacheFile);

        } else {
            return;
        }
        }catch (Exception e){}
    }
}
